#!/usr/bin/env python
# -*- coding=utf8 -*-
"""
# Author: bighu
# Created Time : 2022年02月26日 星期六 15时07分43秒
# File Name: ring.py
# Description:
"""
import rsa
import hashlib
import random

listPubKey = []
userPubKey = ""
userPriKey = ""

def funMakeKeyList():
    """
    产生公钥列表和用户的公私钥对
    """
    userid = random.randint(0,9)
    for i in range(10):
        try:
            tempPub,temoPri = rsa.newkeys(1024)
            if i == userid :
                userPubKey = tempPub
                userPriKey = temoPri
            else:
                listPubKey.append(tempPub)
        except:
            return False

def funGetFileMD5(filePath):
    with open(filePath,'rb') as f:
        filedata = f.read()
    fileMD5 = hashlib.md5(filedata).hexdigest()
    return fileMD5

def __init__():
    funMakeKeyList()

